package com.andy.qi.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

public class WebApi {
    protected Object succ() {
        return new WebResult(0, "ok");
    }
    protected Object succ(Map<String, Object> result) {
        result.put("errcode", 0);
        result.put("errmsg", "ok");
        return result;
    }
    protected Object fail(String reson) {
        return new WebResult(1, reson);
    }
    protected Object reEnter(String reson) {
        return new WebResult(-1, reson);
    }
    protected Map<String, Object> result() {
        return new HashMap<>();
    }
    protected String ip(HttpServletRequest request) {
        return request.getRemoteAddr();
    }
}
